{include file='common/head'}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>银行卡管理</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="{:url('admin/user/bankindex')}" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
            <div class="layui-input-inline">
                <select name="cateid">
                    <option value="">搜索关键词</option>
                    <option value="u_phone">账号</option>
                    <option value="u_name">姓名</option>
                    <option value="b_bank">所属银行</option>
                    <option value="b_card">银行卡号</option>
                </select>
            </div>
            <input type="text" name="Key"  placeholder="请输入关键词" autocomplete="off" class="layui-input">
            <span>添加时间</span><input class="layui-input" placeholder="开始日" name="datemin" id="start">至
            <input class="layui-input" placeholder="截止日" name="datemax" id="end">
            <input type="submit" name="sub" class="layui-btn" value="开始搜索" lay-submit="" lay-filter="sreach">
        </form>
    </div>
    <form class="layui-form" action="" method="post">
    <table class="layui-table">
        <thead>
        <tr style="text-align: center">
            <th style="text-align: center">NO</th>
            <th style="text-align: center">账号</th>
            <th style="text-align: center">姓名</th>
            <th style="text-align: center">所属银行</th>
            <th style="text-align: center">银行卡号</th>
            <th style="text-align: center">添加时间</th>
            <th style="text-align: center">锁定状态</th>
        </tr>
        </thead>
        <tbody>
        {volist name="rs" id="rs"}
        <tr style="text-align: center">
            <td>{$key+1}</td>
            <td>{$rs.u_phone}</td>
            <td>{$rs.u_name}</td>
            <td>{$rs.b_bank}</td>
            <td>{$rs.b_card}</td>
            <td>{$rs.b_createtime}</td>
            {if $Think.session.admin_uid==1}
            <td><input type="checkbox" <?php if ($rs['b_state'] ==0): ?>  checked="" <?php endif; ?> name="status[]" lay-skin="switch" lay-filter="switchSuodoing" lay-text="开启|关闭" value="{$rs.bid}"/></td>
            {else/}
            <td>{if $rs.b_state==1}<button class="layui-btn layui-btn-radius layui-btn-warm">正常</button>{else/}<button class="layui-btn layui-btn-radius layui-btn-danger">锁定</button>{/if}</td>
            {/if}
        </tr>
        {/volist}
        </tbody>
    </table>
    </table>
    <div class="page">
        <div>
        {$page}
        </div>
    </div>
    </form>
</div>
<script>
    layui.use(['laydate','form'], function() {
        var laydate = layui.laydate;
        var form = layui.form;
        //执行一个laydate实例
        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
        form.on('switch(switchSuodoing)', function (data) {
            var id = data.value;
            //alert(111);
            $.ajax({
                url: "{:url('admin/user/bankstate')}",
                type: "post",
                dataType: "JSON",
                data: {bid: id},
                success: function (res) {
                    if (res == 1) {
                        layer.msg('操作成功！');
                        //alert(11);
                        //location.reload();
                        return false;
                    } else {
                        layer.msg('操作失败！');
                        /*setTimeout(function () {
                            location.reload();
                        }, 1000);*/
                        return false;
                    }
                }
            });
        });

    })

</script>

</body>

</html>